FROM node:alpine as build

WORKDIR "/src"

COPY . /src
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.volces.com/g' /etc/apk/repositories && \
	apk update --no-cache && apk add git --no-cache && \
	npm config set registry https://registry.npmmirror.com && \
	npm -g i pnpm && pnpm install && pnpm gulp build

FROM scratch AS export
WORKDIR /
COPY --from=build /src/index.html .
COPY --from=build /src/build ./build



FROM nginx:stable-alpine
WORKDIR /usr/share/nginx/html/
COPY . .
# Override the local source with the built artifacts
COPY --from=export . .


# docker buildx build --provenance=false -t gitea.lntu.edu.cn/youling/learngitbranching .